Component({
  behaviors: ['wx://form-field'],
  options: {
    multipleSlots: true
  },
  /**
   * 组件的属性列表
   */
  properties: {
    value: String,
    label: String,
    type: {
      type: String,
      value: "text"
    },
    placeholder: String,
    maxlength: {
      type: Number,
      value: 140
    },
    leftIcon: String,
    showPassword: {
      type: Boolean,
      value: false
    },
  },
  /**
   * 组件的初始数据
   */
  data: {
    showPasswordIcon: true
  },
  /**
   * 组件外的class类
   */
  externalClasses: ['my-field'],
  /**
   * 组件的方法列表
   */
  methods: {
    getInputValue(e) {
      this.setData({
        value: e.detail.value
      })
      this.triggerEvent('input', {
        value: e.detail.value
      })
    },
    changePassword() {
      this.setData({
        showPasswordIcon: !this.data.showPasswordIcon
      })
    }
  }
})
